#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File   : utils.py.py
# @Email  : xuexia_xu@feidee.com
# @Time   : 2024/4/30 18:00
# @Desc   : 使用hashlib中的md5类将字符串处理成MD5摘要的函数

import hashlib
import random

ALL_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'


def gen_md5_digest(content):
    return hashlib.md5(content.encode()).hexdigest()


def gen_random_code(length=4):
    return ''.join(random.choices(ALL_CHARS, k=length))


